﻿using System;
using System.ServiceModel;
using System.Net;

namespace Lypshare.Net.Server.Service
{
	/// <summary>
	/// Iinterface access service.
	/// </summary>
    [ServiceContract(CallbackContract = typeof(IAccessServiceCallback))]
    public interface IAccessService
    {
        // --------------------------------------------------------
        // Interface Functions
        // --------------------------------------------------------


        /// <summary>
        /// Register the specified address and authed.
        /// </summary>
        /// <param name='address'>
        /// Address.
        /// </param>
        /// <param name='authed'>
        /// Authed.
        /// </param>
        [OperationContract]
        int Register(out IPAddress address, out bool authed);


        /// <summary>
        /// Auth the specified username and password.
        /// </summary>
        /// <param name='username'>
        /// If set to <c>true</c> username.
        /// </param>
        /// <param name='password'>
        /// If set to <c>true</c> password.
        /// </param>
        [OperationContract]
        bool Auth(String username, String password);


        /// <summary>
        /// Join the specified scope.
        /// </summary>
        /// <param name='scope'>
        /// Scope.
        /// </param>
        [OperationContract(IsOneWay = true)]
        void Join(String scope);


        /// <summary>
        /// Syncronize with the specified clientId and port.
        /// </summary>
        /// <param name='clientId'>
        /// Client identifier.
        /// </param>
        /// <param name='port'>
        /// Port.
        /// </param>
        [OperationContract]
        int Syncronize(int clientId, int port);


        /// <summary>
        /// Keeps the connection.
        /// </summary>
        [OperationContract(IsOneWay = true)]
        void KeepConnection();


        /// <summary>
        /// Disconnect this instance.
        /// </summary>
        [OperationContract(IsOneWay = true)]
        void Disconnect();

    } // interface IAccessService
} // namespace Lypshare.Net.Server.Service